#include "jni_util.h"

#include "log_util.h"

jint registerNatives(JNIEnv *env, const char *class_name,
    JNINativeMethod *methods, int method_num) {
  jclass clazz = env->FindClass(class_name);
  if (clazz != 0) {
    jint result = env->RegisterNatives(clazz, methods, method_num);
    if (result < 0) {
      LOGE("registerNatives failed (class=%s)", class_name);
      return JNI_ERR;
    }
  } else {
    LOGE("registerNatives, class(%s) not found", class_name);
    return JNI_ERR;
  }
  return JNI_OK;
}
